import time

atm = {
    'Account number':['Tom','Kank','Tim'],
    'Password': ['1100', '1200','1300'],
    'money':[1000,2000,3000],
    'history':[[1000],[2000],[3000]]
}

while True:
    user_number = str(input("请输入您的账户名：\n"))
    if user_number in atm['Account number']:
        user_index = atm['Account number'].index(user_number)
        while True:
            user_Password = str(input("请输入密码：\n"))
            if user_Password == atm['Password'][user_index]:
                print('登录成功！')
                isLogin = True
                atm['history'][user_index].append(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + '         登陆系统')
                break
            else:
                print('密码错误，请重试！\n')
        break
    else:
        print('不存在该用户！\n')

while isLogin:
     print('\n选择要办理的业务：1.取款，2.存款，3.查询余额，4.退出')
     service_num = int(input())
     if service_num == 1:
        money_out = int(input('请输入取款金额：'))
        if money_out > 0 and money_out < int(atm['money'][user_index]):
            atm['money'][user_index]  = int(atm['money'][user_index]) - money_out
            print('剩余存款：', atm['money'][user_index])
            atm['history'].append(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + '         取款' + str(money_out))
        else:
            print('余额不足！！')
     elif service_num == 2:
        money_in = int(input('请输入金额：'))
        if money_in < 0:
            print('存款必须金额大于0')
        else:
            atm['money'][user_index]  = int(atm['money'][user_index]) + money_in
            print('剩余存款：', atm['money'][user_index])
            atm['history'][user_index].append(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + '         存款' + str(money_in))
     elif service_num == 3:
         for record in atm['history'][user_index]:
            print(record)
     elif service_num == 4:
         atm['history'][user_index].append(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + '         退出系统')
         break